<div id="categories">
<? echo $adminMenu->manage(); ?>
<h2><?php __("CATEGORIES_ADMIN_TITLE");?> (<? echo $html->link(__('CATEGORY_NEW',true), array('controller'=>'categories','action'=>'add'));?>)</h2>
<? echo $form -> create(array('action'=>'delete_categories')); ?>
<table cellpadding="3" cellspacing="1" width="100%">
<tr>
	<td width="7%"></td>
	<td></td>
	<td width="20%"></td>
	<td width="10%"></td>
</tr>
<tr class="table_head">
	<td colspan="2" class="first-top">
		<? echo $pagination -> create(null,'categories'); ?>
	</td>
	<td colspan="2" class="last-top">
		<? __('SORT_BY'); ?>: <?php echo $paginator->sort(__('NAME',true),'name');?>
	</td>
</tr>
<tr>
	<th><? __('ACTION'); ?></th>
	<th><? __('NAME'); ?></th>
	<th><? __('CATEGORY_ARTICLES'); ?></th>
	<th><? __('DELETE'); ?> <input type="checkbox" onclick="checkAll(this,'CategoryDeleteCategoriesForm')"/></th>
</tr>
<?php
$i = 0;
foreach ($categories as $category):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
		<td>
			<? echo $html->link($html->image('edit.png',array('alt'=>__('EDIT', true))),array('action'=>'edit', $category['Category']['id']),array('title'=>__('EDIT',true)),null,false); ?> 
			<? echo $html->link($html->image('eye.png',array('alt'=>__("PREVIEW",true))),"/categories/view/".$category["Category"]["seo_link"],array('title'=>__('PREVIEW',true),"target"=>"new"),null,false); ?>
			<? echo $html->link($html->image('bin.png',array('alt'=>__('DELETE', true))), array('action'=>'delete', $category['Category']['id']),array('title'=>__('DELETE',true)), __('DELETE_ITEM', true).' #' . $category['Category']['name'],false); ?>
		</td>
		<td>
			<? echo $html->link($category['Category']['name'], array('action'=>'edit', $category['Category']['id'])); ?>
		</td>
		<td>
			<?php echo count($category['Article']);?>
		</td>
		<td  align="center">
			<input type="checkbox" name="data[CategoriesDelete][]" value="<? echo $category['Category']['id']; ?>"/>
		</td>
	</tr>
<?php endforeach; ?>
<tr class="table_head">
	<td colspan="2" class="first-bottom">
		<? echo $pagination -> create(null,'categories'); ?>
	</td>
	<td colspan="2" class="last-bottom">
		<? __('SORT_BY'); ?>: <?php echo $paginator->sort(__('NAME',true),'name');?>
	</td>
</tr>
</table>
<div style="float: right; margin: 1em;"><? echo $form -> submit(__('DELETE',true)); ?></div>
</form>
</div>